package com.hxkj.client.service.taglib.impl;

import com.hxkj.client.service.taglib.AnalyzeArticleService;
import com.hxkj.domain.po.FreeMarker;
import com.integral.mall.file.po.SysFile;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * 生成文章静态页面
 *
 * @author chenfangzhou 2018/09/14
 */
@Service
@Slf4j
public class AnalyzeArticleServiceImpl implements AnalyzeArticleService {

    @Autowired
    private AnalyzeChannelServiceImpl analyzeChannelServiceImpl;

    /**
     * 模板解析
     *
     * @param freeMarker
     * @throws Exception
     */
    @Override
    @Async("freemarkerTaskExecutor")
    public SysFile analyzeArticle(FreeMarker freeMarker) throws Exception {
        return analyzeChannelServiceImpl.getSysFileResultDataStruct(freeMarker);
    }

    /**
     * 可视化
     *
     * @param freeMarker
     * @throws Exception
     */
    @Override
    public SysFile visualizationArticle(FreeMarker freeMarker) throws Exception {
        return analyzeChannelServiceImpl.getSysFileResultDataStruct(freeMarker);
    }
}
